﻿<%@ Page Title="" Language="VB" MasterPageFile="~/KYC/MasterPageKYC.master" AutoEventWireup="false"
    CodeFile="frmDailyCBSSync.aspx.vb" Inherits="KYC_checkIndividualSearch" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <script type="text/javascript">

        $(document).ready(function () {
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
            $("input[id$=btnAdd]").click(function () {
                window.open('IndividualCDD.aspx?uniqueID=' + $("input[id$=txtNo]").val()
                + '&FirstNameTH=' + $("input[id$=txtFirstNameTH]").val()
                + '&MidNameTH=' + $("input[id$=txtMidNameTH]").val()
                + '&LastNameTH=' + $("input[id$=txtLastNameTH]").val()
                + '&FirstNameEN=' + $("input[id$=txtFirstNameEN]").val()
                + '&MidNameEN=' + $("input[id$=txtMidNameEN]").val()
                + '&LastNameEN=' + $("input[id$=txtLastNameEN]").val()
                + '&TypeKYC=1'
                , '_self');
            });

            $("input[id$=txtStartDate]").datepicker($.extend({}, $.datepicker.regional['th'], {
                yearAddToDisplay: 543,
                dateFormat: 'dd/mm/yy',
                showOn: "button",
                buttonImage: "../img/calendar.gif",
                buttonImageOnly: true
            }));
            $("input[id$=txtEndDate]").datepicker($.extend({}, $.datepicker.regional['th'], {
                yearAddToDisplay: 543,
                dateFormat: 'dd/mm/yy',
                showOn: "button",
                buttonImage: "../img/calendar.gif",
                buttonImageOnly: true
            }));



            function EndRequestHandler(sender, args) {
                $("input[id$=btnAdd]").click(function () {
                    window.open('IndividualCDD.aspx?uniqueID=' + $("input[id$=txtNo]").val()
                + '&FirstNameTH=' + $("input[id$=txtFirstNameTH]").val()
                + '&MidNameTH=' + $("input[id$=txtMidNameTH]").val()
                + '&LastNameTH=' + $("input[id$=txtLastNameTH]").val()
                + '&FirstNameEN=' + $("input[id$=txtFirstNameEN]").val()
                + '&MidNameEN=' + $("input[id$=txtMidNameEN]").val()
                + '&LastNameEN=' + $("input[id$=txtLastNameEN]").val()
                + '&TypeKYC=1'
                , '_self');
                });

                $("input[id$=txtStartDate]").datepicker($.extend({}, $.datepicker.regional['th'], {
                    yearAddToDisplay: 543,
                    dateFormat: 'dd/mm/yy',
                    showOn: "button",
                    buttonImage: "../img/calendar.gif",
                    buttonImageOnly: true
                }));
                $("input[id$=txtEndDate]").datepicker($.extend({}, $.datepicker.regional['th'], {
                    yearAddToDisplay: 543,
                    dateFormat: 'dd/mm/yy',
                    showOn: "button",
                    buttonImage: "../img/calendar.gif",
                    buttonImageOnly: true
                }));
            }
        });

        var hasSubmitted = 0;
        function NoDoubleSubmit() {
            var divMsg = document.getElementById('Processing');
            if (hasSubmitted == 0) {
                hasSubmitted = 0;
                divMsg.style.display = 'block';
                return true;
            }
            return false;
        }
        var prm = Sys.WebForms.PageRequestManager.getInstance();

        prm.add_initializeRequest(InitializeRequest);
        prm.add_endRequest(EndRequest);

        function InitializeRequest(sender, args) {
            $get('ContentPlaceHolder1_UpdatePanel1').style.cursor = 'wait';
        }

        function EndRequest(sender, args) {
            $get('ContentPlaceHolder1_UpdatePanel1').style.cursor = 'auto';
        }

    </script>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table style="width: 100%;">
                <tr>
                    <td align="right">
                        <asp:Label ID="lblDept" runat="server"></asp:Label>
                    </td>
                    <td style="text-align: left">
                        <asp:DropDownList ID="ddlDepartment" runat="server" AutoPostBack="True" CssClass="control"
                            Height="25px" Width="196px">
                        </asp:DropDownList>
                    </td>
                    <td style="text-align: right">
                        <asp:Label ID="lblBranch" runat="server"></asp:Label>
                    </td>
                    <td style="text-align: left">
                        <asp:DropDownList ID="ddlBranch" runat="server" CssClass="control" Height="25px"
                            Width="183px">
                        </asp:DropDownList>
                    </td>
                    <td align="right">
                        <asp:Label ID="lblUserName" runat="server"></asp:Label>
                    </td>
                    <td style="text-align: left">
                        <asp:TextBox ID="txtUserName" runat="server" AutoCompleteType="Disabled" CssClass="control"
                            Height="20px" MaxLength="20" Width="196px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right;">
                        <asp:Label ID="lblEtLCustomer" runat="server"></asp:Label>
                    </td>
                    <td style="text-align: left">
                        <asp:DropDownList ID="ddlETLcustomer" runat="server" CssClass="control" Height="25px"
                            Width="183px">
                        </asp:DropDownList>
                    </td>
                    <td style="text-align: right;">
                        <asp:Label ID="lblEtLAccount" runat="server"></asp:Label>
                    </td>
                    <td style="text-align: left">
                        <asp:DropDownList ID="ddlETLaccount" runat="server" CssClass="control" Height="25px"
                            Width="183px">
                        </asp:DropDownList>
                    </td>
                     <td align="right">
                        <asp:Label ID="ldlUniqueID" runat="server"></asp:Label>
                    </td>
                    <td style="text-align: left">
                        <asp:TextBox ID="txtUniqueID" runat="server" AutoCompleteType="Disabled" CssClass="control"
                            Height="20px" MaxLength="20" Width="196px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="top">
                        ความสมบูรณ์ของข้อมูลลูกค้า
                    </td>
                    <td align="left" valign="top">
                        <asp:RadioButtonList ID="rdolIsCustComplete" runat="server" RepeatDirection="Horizontal">
                            <asp:ListItem Value="A">ทั้งหมด</asp:ListItem>
                            <asp:ListItem Value="Y">สมบูรณ์</asp:ListItem>
                            <asp:ListItem Value="N">ไม่สมบูรณ์</asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                    <td align="right" valign="top">
                        ความสมบูรณ์ของข้อมูลบัญชี
                    </td>
                    <td align="left" valign="top">
                        <asp:RadioButtonList ID="rdolIsAccComplete" runat="server" RepeatDirection="Horizontal">
                            <asp:ListItem Value="A">ทั้งหมด</asp:ListItem>
                            <asp:ListItem Value="Y">สมบูรณ์</asp:ListItem>
                            <asp:ListItem Value="N">ไม่สมบูรณ์</asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                             <td align="right" valign="top">
                                 ผลิตภัณฑ์</td>
                      <td style="text-align: left">
                        <asp:DropDownList ID="ddlSection" runat="server" CssClass="control" Height="25px"
                            Width="183px">
                            <asp:ListItem Value="A">ทั้งหมด</asp:ListItem>
                            <asp:ListItem Value="D">การเงิน</asp:ListItem>
                            <asp:ListItem Value="L">สินเชื่อ</asp:ListItem>
                            <asp:ListItem Value="P">ตั๋วสัญญา</asp:ListItem>
                            <asp:ListItem Value="N">NPA</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        วันที่ทำการ Sync ข้อมูลตั้งแต่
                    </td>
                    <td>
                        <asp:TextBox ID="txtStartDate" runat="server"></asp:TextBox>
                    </td>
                    <td align="right">
                        วันที่ทำการ Sync ข้อมูลถึง
                    </td>
                    <td>
                        <asp:TextBox ID="txtEndDate" runat="server" Width="154px"></asp:TextBox>
                    </td>
                    <td>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: right;">
                        <asp:Button ID="btnSearch" runat="server" CssClass="control" Text="ค้นหา" Width="135px" />
                        <asp:Button ID="btnPrint" runat="server" CssClass="control" Text="พิมพ์" 
                        Width="135px" />
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center">
                        <asp:Label ID="lblMsg" runat="server" ForeColor="Red" Text="ไม่พบข้อมูล" Font-Bold="True"
                            Font-Size="30px" Height="30px" Visible="False"></asp:Label>
                        <span id="Processing" style="display: none">
                            <img src="../img/icon/ajax-loader.gif" alt="Please wait" />
                            กรุณารอสักครู่ ระบบกำลังค้นหาข้อมูล... </span>
                        <asp:GridView ID="grdIndividual" runat="server" CellPadding="4" ForeColor="#333333"
                            AutoGenerateColumns="False" Width="100%" AllowPaging="True" 
                            ShowHeaderWhenEmpty="True" EmptyDataText=" " 
                            EnableSortingAndPagingCallbacks="True">
                            <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                            <Columns>
                                <asp:TemplateField HeaderText="เลขประจำตัวลูกค้า">
                                    <ItemTemplate>
                                        <asp:Label ID="lblCustCode" runat="server" Text='<%#  "" & iif(Eval("TRANTYPE")=1, Eval("CUSTCODE"),iif(Eval("TRANTYPE")=2,"ลูกค้าขาจร",iif(Eval("TRANTYPE")=3,"ผู้จัดการกองทุน",iif(Eval("TRANTYPE")=4,"ผู้ถือหุ้น",(Eval("CUSTCODE")))))) %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle Width="80px" />
                                </asp:TemplateField>
                                <asp:BoundField HeaderText="เลขที่บัตรประชาชน/หนังสือเดินทาง" DataField="UNIQUEID">
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle Width="100px" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="ชื่อลูกค้า (ไทย)">
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblTHName" runat="server" Text='<%# Eval("THFIRSTNAME") & "  " & Eval("THMIDNAME") & "  " & Eval("THLASTNAME") %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Left" Width="150px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ชื่อลูกค้า (อังกฤษ)">
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblENName" runat="server" Text='<%# Eval("ENFIRSTNAME") & "  " & Eval("ENMIDNAME") & "  " & Eval("ENLASTNAME") %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Left" Width="150px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ระดับ / สถานะ">
                                    <ItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%# eval("AMLCDD") & " / " & eval("ETL_STATUS") %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" Width="40px" />
                                </asp:TemplateField>
                                <asp:BoundField HeaderText="D" DataField="DEPD">
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle Width="5px" />
                                </asp:BoundField>
                                <asp:BoundField HeaderText="L" DataField="DEPL">
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle Width="5px" />
                                </asp:BoundField>
                                <asp:BoundField HeaderText="P" DataField="DEPP">
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle Width="5px" />
                                </asp:BoundField>
                                <asp:BoundField HeaderText="N" DataField="DEPN">
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle Width="5px" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="ปรับปรุงล่าสุด">
                                    <ItemTemplate>
                                        <asp:Label ID="lblUpdateDate" runat="server" Text='<%# Eval("UPDATEDATE") %>'></asp:Label>
                                        <asp:Label ID="lblDepUpdate" runat="server" Text='<%# "(" & Eval("DEPUPDATE") & ")" %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Left" Width="90px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ปรับปรุงโดย">
                                    <ItemTemplate>
                                        <asp:Label ID="lblUpdateBy" runat="server" Text='<%# Eval("UpdateBy") %>'></asp:Label>
                                        &nbsp;/
                                        <asp:Label ID="lblBranchCode" runat="server" Text='<%# Eval("BranchCode") %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Left" Width="100px" />
                                </asp:TemplateField>
                                <asp:BoundField HeaderText="ผลการเชื่อมโยง (CBS/KYC)" DataField="ETL_STATUS">
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Center" Width="40px" />
                                </asp:BoundField>
                                <asp:BoundField HeaderText="ความสมบรูณ์ของข้อมูลลูกค้า" DataField="CUST_COMPLETE_FLAG">
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Center" Width="50px" />
                                </asp:BoundField>
                                <asp:BoundField HeaderText="หมายเลขบัญชี" DataField="ACCOUNTNO">
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Center" Width="100px" />
                                </asp:BoundField>
                                <asp:BoundField HeaderText="ผลการเชื่อมโยงข้อมูลบัญชี (CBS/KYC)" DataField="ETL_ACCT_STATUS">
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Center" Width="50px" />
                                </asp:BoundField>
                                <asp:BoundField HeaderText="ความสมบูรณ์ของข้อมูลบัญชี" DataField="KYCCOMPLETE">
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Center" Width="50px" />
                                </asp:BoundField>
                            </Columns>
                            <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                            <PagerSettings Mode="NumericFirstLast" />
                            <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" CssClass="cssPager" />
                            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                            <HeaderStyle BackColor="#FF9933" Font-Bold="True" ForeColor="White" />
                            <AlternatingRowStyle BackColor="White" />
                        </asp:GridView>
                    </td>
                </tr>
            </table>
            <div align="right">
                <asp:Label ID="lblTotal" runat="server" Font-Bold="True" ForeColor="#003300"></asp:Label>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
